/*************************************************************************

File:			replication_descriptive 
Date:			20 June 2025 

Description:	Replication of descriptive information from the main text

Note:			All numerical output, including table shown in the log-file 
				All figures stored on disk as PDF
				
*************************************************************************/


/*

	Descriptive information in main text 
	
	- Distribution of RRP governments in sample 
	- Figure 1 
	- Figure 2 
	- Descriptive statistics on earmarked and bilateral commitments 
	- Table 1 (covariate balance statistics) 
	
*/



* Distribution of RRP governments 

sum rrpgov_th

* Figure 1: annual share of RRP governments 

preserve 
collapse (mean) rrpgov_th, by(year) 

quietly tsset year 

quietly tssmooth ma ma1 = rrpgov_th, window(2 1 2) 

line ma1 year, sort ///
	xtick(1990(5)2020) /// 
	ytitle("Annual share of RRP governments") /// 
	ylab(0(.1).4) 
	
gr export figure1.pdf, replace 

restore 	


* Figure 2: Average foreign aid commitments 

preserve 

quietly statsby, by(rrpgov_th): ci means c 

twoway bar mean rrpgov_th, base(0) barw(0.90) bfcolor(gray*0.4)  /// 
	|| rcap ub lb rrpgov_th, /// 
	xla(0 "No RRP" 1 "RRP", noticks) ///
	legend(off) xtitle("") ///
	yla(0(20)100) ytick(0(10)100, grid) ///
	ytitle("Avg. EF in USD (millions)") /// 
	xsize(6) ysize(6.75)

graph save figure2a.gph, replace 	

restore 

preserve 

quietly statsby, by(rrpgov_th): ci means c_bil  

twoway bar mean rrpgov_th, base(0) barw(0.90) bfcolor(gray*0.4)  /// 
	|| rcap ub lb rrpgov_th, /// 
	xla(0 "No RRP" 1 "RRP", noticks) ///
	legend(off) xtitle("") ///
	ytitle("Avg. bilateral aid in USD (millions)") /// 
	xsize(6) ysize(6.75)

graph save figure2b.gph, replace 	

graph combine figure2a.gph figure2b.gph 
graph export figure2.pdf, replace 

restore 



*	Means and standard deviation of earmarked commitments (c) 
* 	and of bilateral commitment (c_bil)	as reported in-text 
 
mean c if c!=., over(rrpgov_th)
mean c_bil if c_bil!=., over(rrpgov_th)


* Table 1: balance of time-varying covariates (loop) 

global bls /// 
	bl_gdpcons_bil bl_govduration ///
	bl_GDPpc bl_unemp   /// 
	bl_parl 


local depvars lag_gdpcons_bil ///
	lag_GDPpc lag_govduration ///
	lag_dac lag_unemp ///
	lag_parl lag_oecdur 	
		
tempname results 

tempfile tvaltable 

postfile `results' str40 depvar double t_unweighted /// 
	double t_weighted using `tvaltable', replace

* Loop for balance assessment 
foreach y of local depvars {
		
	* Unweighted regression
	quietly reg `y' $bls lag_rrpgov_th rrpgov_th, robust 
	local t_unw = abs(_b[rrpgov_th] / _se[rrpgov_th])
	local t_unw = round(`t_unw', 0.01)
	
	* Weighted regression
	quietly reg `y' $bls lag_rrpgov_th rrpgov_th [pw=w], robust 
	local t_w = abs(_b[rrpgov_th] / _se[rrpgov_th]) 
	local t_w = round(`t_w', 0.01)
	
	* Post results 
	post `results' ("`y'") (`t_unw') (`t_w')
	
}	
	
postclose `results' 
	
use `tvaltable', clear
list 

use replication, clear 




